﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package GameMode {
    import flash.events.*;
    import Engine.Helpers.*;
    import Events.*;
    import Classes.*;
    import Transactions.*;
    import Classes.util.*;
    import Modules.stats.types.*;

    public class GMEditRotate extends GMEdit {

        public function GMEditRotate(){
            m_showMousePointer = true;
            m_cursorImage = EmbeddedArt.hud_act_rotate;
            m_uiMode = UIEvent.ROTATE;
        }
        override public function enableMode():void{
            super.enableMode();
        }
        override protected function isObjectSelectable(_arg1:GameObject):Boolean{
            return (((_arg1.canBeDragged()) && (_arg1.canBeRotated())));
        }
        override public function onMouseUp(_arg1:MouseEvent):Boolean{
            var _local3:int;
            var _local4:Vector3;
            var _local5:GMObjectMove;
            var _local6:Object;
            var _local2:MapResource = (m_selectedObject as MapResource);
            if (((_local2) && (!(m_dragging)))){
                _local3 = _local2.getDirection();
                _local2.rotate();
                _local4 = _local2.getSize();
                if (_local4.x != _local4.y){
                    Global.world.addGameMode(new GMEditRotate());
                    _local5 = new GMObjectMove(_local2, null, getMouseStagePos(), _local3);
                    _local5.doImmediateDrop();
                    Global.world.addGameMode(_local5, false);
                } else {
                    _local6 = new Object();
                    _local6.x = _local2.getPosition().x;
                    _local6.y = _local2.getPosition().y;
                    _local6.state = _local2.getState();
                    _local6.direction = _local2.getDirection();
                    _local6 = _local2.addTMoveParams(_local6);
                    GameTransactionManager.addTransaction(new TMove(_local2, _local6));
                };
                _local2.trackDetailedAction(TrackedActionType.ROTATE, "successful", "");
                _local2.trackDetailedAction(TrackedActionType.ROTATE, "age", "", _local2.getAge());
            };
            return (super.onMouseUp(_arg1));
        }

    }
}//package GameMode 
